$.ajaxPrefilter(function(options){
    options.url = 'http://api-breakingnews-web.itheima.net' + options.url

    if(options.url.indexOf('/my/') !== -1){
        // 设置
        // console.log(options.url);
        options.headers = {
            Authorization:localStorage.getItem('token')
        }
    }
    // 限制用户的访问权限
    options.complete = function(xhr){
        if(xhr.responseJSON.status === 1 && xhr.responseJSON.message === '身份认证失败！'){
            localStorage.removeItem('token')
            location.href = 'login.html'
        }
    }
})